<?php

class Application_Model_Banner extends Application_Model_DomainObject {
	protected $_id;
    protected $_title;
    protected $_picurl;
    protected $_order;
    protected $_status;
    protected $_url;

       public static function getAll($condition = array())
    {
        if(!is_array($condition)){
            return false;
        }       
        return self::getDao()->queryAll($condition,"order desc");
    }
    public static function getgonggao(){      
        $name=self::getDao()->queryOne(array('status'=>2));  
        if($name) return $name;
        else  return ""; 
    }
    public static function editgonggao($banner){      
        $name=self::getDao()->queryOne(array('status'=>2));  
        if($name)  $hot = Application_Model_Banner::load($name->id);
        else   $hot = new Application_Model_Banner();
        $hot->title = $banner['title'];
        $hot->url = $banner['url'];
        $hot->order = $banner['order'];
        $hot->picurl = '';
        $hot->status = $banner['status'];      
        $hot->save();      
    }
 /**
     * 添加
     */
    public static function add($goods)
    {
        if($goods['id'])  $hot = Application_Model_Banner::load($goods['id']);
        else   $hot = new Application_Model_Banner();
        $hot->title = $goods['title'];
        $hot->url = $goods['url'];
        $hot->order = $goods['order'];
        $hot->picurl = $goods['picurl'];
        $hot->status = $goods['status'];      
        $hot->save();
        return $hot->Id;
    }        

}